home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1997 / MacHack 1997.toast / Hacks / Hacks ’97 / Warrior’s Progress / source code / Source / Libraries / Menus / Low Level / MenuResult.h < prev   
Encoding:
Text File  |  1997-06-28  |  747 b   |  52 lines  |  [TEXT/CWIE]

  1. // MenuResult.h
  2.  
  3. #ifndef MenuResult_h
  4. #define MenuResult_h
  5.  
  6. #ifndef Integers_h
  7. #include "Integers.h"
  8. #endif
  9. #ifndef MenuID_h
  10. #include "MenuID.h"
  11. #endif
  12. #ifndef Assert_h
  13. #include "Assert.h"
  14. #endif
  15.  
  16. class MenuResult
  17.   {
  18.     private:
  19.         MenuID menu;
  20.         uint16 item;
  21.     
  22.     public:
  23.         MenuResult( int32 combined )
  24.           : menu( Word1( combined ) ),
  25.              item( Word0( combined ) - 1 )
  26.           {
  27.             Assert( combined == 0 || Word0( combined ) > 0 );
  28.           }
  29.         
  30.         MenuResult( MenuID theMenu, uint16 theItem )
  31.           : menu( theMenu ),
  32.              item( theItem )
  33.           {
  34.           }
  35.         
  36.         bool Null() const            { return menu == 0; }
  37.         
  38.         MenuID Menu() const
  39.           {
  40.             Assert( !Null() );
  41.             return menu;
  42.           }
  43.         
  44.         uint16 Item() const
  45.           {
  46.             Assert( !Null() );
  47.             return item;
  48.           }
  49.   };
  50.  
  51. #endif
  52.